DROP FUNCTION IF EXISTS usp_[%tablename%]_sel_by_[%fieldname%]([%datatypesize%]);

CREATE OR REPLACE FUNCTION usp_[%tablename%]_sel_by_[%fieldname%] (
  param_[%fieldname%] [%datatypesize%]
)  RETURNS TABLE ([%columntypes%]) AS $$ 
-- Select a set of [%tablename%] table records by [%fieldname%].
--  [%datestamp%] - auto generated usp_select_by_fk  
BEGIN 
  RETURN QUERY
  SELECT
    [%columns%] 
  FROM [%tablename%] t
  WHERE 
    t.[%fieldname%] = param_[%fieldname%]  AND
    t.is_deleted = 0;
END;
$$ LANGUAGE plpgsql;